//package com.config;
//
//import com.alibaba.druid.pool.DruidDataSource;
//import com.alibaba.druid.support.http.StatViewServlet;
//import com.alibaba.druid.support.http.WebStatFilter;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.boot.web.servlet.FilterRegistrationBean;
//import org.springframework.boot.web.servlet.ServletRegistrationBean;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//import javax.sql.DataSource;
//import java.sql.SQLException;
//import java.util.Arrays;
//
///**
// * @author WZ
// * @version 1.0
// * @date 2021/9/2 14:06
// */
//@Configuration
//public class MyDataSourceConfig {
//
//@Bean
//@ConfigurationProperties("spring.datasource")
//public DataSource dataSource() throws SQLException {
//	DruidDataSource druidDataSource=new DruidDataSource();
////开启德鲁伊sql监控功能
////	druidDataSource.setFilters("stat,wall");
//	return druidDataSource;
//}
//	@Bean
//	public ServletRegistrationBean statViewServlet(){
//		StatViewServlet statViewServlet = new StatViewServlet();
//		ServletRegistrationBean<StatViewServlet> statViewServletServletRegistrationBean = new ServletRegistrationBean<>(statViewServlet, "/druid/*");
//
//             statViewServletServletRegistrationBean.addInitParameter("loginUsername","admin");
//		statViewServletServletRegistrationBean.addInitParameter("loginPassword","123456");
//		return statViewServletServletRegistrationBean;
//
//	}
//
//	@Bean
//	public FilterRegistrationBean webStatFilter(){
//		WebStatFilter webStatFilter = new WebStatFilter();
//		FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean<WebStatFilter>(webStatFilter);
//		filterRegistrationBean.setUrlPatterns(Arrays.asList("/*"));
//		filterRegistrationBean.addInitParameter("exclusions","*.js,*.gif,*.png,*.css,*.ico,/druid/*");
//		return filterRegistrationBean;
//
//
//	}
//}
